package com.test.leetcode;

class Parent {

	public void b() {

	}
}

public class GuessNumberSolution extends Parent {

	public void b(String str) {

		str.length();
		byte[] bs = new byte[10];
		System.out.println(bs.length);
		;
	}

	public void a() {

	}

	void a(String str) {

	}

	static byte bt;
	static short s;
	static int i;
	static long l;
	static char c;
	static double d;
	static float f;
	static boolean b;

	public static void main(String[] args) {
		String str1 = "hello", str2 = "hello", str3 = "hel" + "lo", str4 = new String("hello"),
				str5 = new String("hello");
		System.out.println(str1 == str2);
		System.out.println(str3 == str2);
		System.out.println(str1 == str4);
		System.out.println(str5 == str4);

		System.out.println("-------");

		System.out.println(-5 >> 3);
		System.out.println(String.valueOf(s));

		System.out.println(String.valueOf(c));
		System.out.println(String.valueOf(d));
		System.out.println(String.valueOf(f));
		System.out.println(String.valueOf(b));
		// 2126753390
		// 1702766719
		// System.out.println(guessNumber(2126753390));//guessNumber(2126753390)
	}

	public static int guessNumber(int n) {
		int res = guess(1);
		if (res == 0)
			return 1;
		res = guess(n);
		if (res == 0)
			return n;

		int begin = 1, end = n, temp = (begin + (end - 1)) / 2;
		res = guess(temp);

		while (res != 0) {
			System.out.println("--" + temp);
			if (res == 1) {
				begin = temp;
			} else if (res == -1) {
				end = temp;
			}
			temp = (begin + (end - 1)) / 2;
			res = guess(temp);
		}

		return temp;
	}

	public static int guess(int n) {
		int pa = 1702766719;
		if (n > pa)
			return -1;
		if (n < pa)
			return 1;
		return 0;
	}

}